import { getMyRecords, getUserAddressList } from '@/api';

const state = {
    addressList: [],
    records: []
}
const mutations = {
    GetAddress(state, val) {
        state.addressList = val
    },
    GetRecords(state, val) {
        state.records = val
    }
}
const actions = {
    async getAddress({ commit }) {
        let result = await getUserAddressList()
        if (result.code = '200') {
            commit('GetAddress', result.data)
        }
    },
    async getRecords({ commit }, page = 0, limit = 5) {
        let result = await getMyRecords(page, limit)
        if (result.code = '200') {
            commit('GetRecords', result.data)
        }
    },
}
const getters = {}
export default {
    namespaced: true,
    state, mutations, actions, getters
}